<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script type="text/javascript" src="../js/angular.min.js" ></script>
	</head>
	<!--定义模块名 -->
	<body ng-app="myapp" ng-controller="myctrol">
		<div>
		<table width="300px" align="center" border="1px" cellspacing="2px" cellpadding="3px">
	
			<tr>
				<td>序号</td>
				<td>编号</td>
				<td>商品名</td>
				<td>价格</td>
			</tr>
			<tr ng-repeat="p in products">
				<td>{{$index+1}}</td>
				<td>{{p.id}}</td>
				<td>{{p.name}}</td>
				<td>{{p.price}}</td>			
			</tr>
		</table>
		</div>
		
		<script type="text/javascript">
			//初始化模块
			var myapp=angular.module("myapp",[])
			//定义模块的控制器
			//注入$scope作用域对象
			myapp.controller("myctrol",["$scope",function($a){
				$a.products=[{
					id:12,
					name:"洗衣机",
					price:2399
				},{
					id:13,
					name:"电视机",
					price:3399
				},
				{
					id:14,
					name:"麻将机",
					price:1399
				}]
			}])
		</script>
	</body>
</html>
